<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增会员缴费记录')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-record-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">缴纳金额：</label>
                <div class="col-sm-8">
                    <input name="amount" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">会员：</label>
                <div class="col-xs-6">
                        <label th:each="member:${members}" class="check-box">
                            <input name="member" type="checkbox" th:value="${member.userAccount}" th:text="${member.userName}" >
                        </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />

    <script th:inline="javascript">
        var prefix = ctx + "biz/record"

        $("#form-record-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-record-add").serializeArray();
                var members = $.form.selectCheckeds("member");
                data.push({"name": "members", "value": members});
                $.operate.save(prefix + "/add", data);
            }
        }

    </script>
</body>
</html>